package com.ymatou.iapi.doorgod.apigateway.service;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class Utils {

	public static String generateMD5(Map map, String secret) {
		StringBuilder sb = new StringBuilder(secret);
		Set es = map.entrySet();
		Iterator it = es.iterator();
		while (it.hasNext()) {
			Map.Entry entry = (Map.Entry) it.next();
			String k = (String) entry.getKey();
			String v = (String) entry.getValue();
			if (v == null) {
				v = "";
			}
			if (!"sign".equals(k)) {
				sb.append(k).append(v);
			}
		}
		sb.append(secret);

		return Md5Util.getMd5(sb.toString());
	}

}
